package com.gupao.gupaoeduvippattern.javaBase.thread.day01_3;

/**
 * @author Administrator
 * @date 2020-12-05 18:45
 */
public class TestJoin {

    public static void main(String[] args) throws InterruptedException {
        ThreadTest t1 = new ThreadTest("A");
        ThreadTest t2 = new ThreadTest("B");
        ThreadTest t3 = new ThreadTest("C");

        t1.start();
//      t.join()方法只会使主线程(或者说调用t.join()的线程)进入等待池并等待t线程执行完毕后才会被唤醒。
//      并不影响同一时刻处在运行状态的其他线程。
//        t1.join();

        t2.start();
        t2.join();

        t3.start();


    }

}


class ThreadTest extends Thread {

    private String name;

    public ThreadTest(String name){
        this.name = name;
    }

    public void run(){
        for(int i=1; i<=10; i++){
            System.out.println(name + "-" +i);
        }
    }

}
